REGISTER json-simple-1.1.jar;
REGISTER elephant-bird-core-4.0.jar;
REGISTER elephant-bird-pig-4.0.jar
REGISTER elephant-bird-hadoop-compat-4.0.jar;
REGISTER porkbelly.jar
mydata = load '/tmp/search-example.json' USING com.twitter.elephantbird.pig.load.JsonLoader('-nestedLoad') as (json:map[]);
token_count_rows = foreach mydata generate FLATTEN(json#'keywordCount') as (keywordCounts:map[]);
keyword_rows = foreach token_count_rows generate org.porkbelly.json.JsonMapToTuple(keywordCounts) as (name:chararray,count:long);
dump keyword_rows;